package Engine.Model
{
	import Engine.Manager.EngineManager;
	import GameMain.Game;
	
	import GameMain.Macro.MacroEvent;
	
	import Interface.Model.ISocketManager;
	
	import library.SocketData.SocketData;
	
	public class SocketManager implements ISocketManager
	{
		
		
		private var _socket:GameSocket;
		private var _socketCode:int = 0;
		private var _socketEntityID:int = 0;
		
		
		public function SocketManager()
		{
			this._socket = new GameSocket("Main:");
		}
		
		
		public function sendMessageData(msgID:int,msgData:*):void
		{
			if(!this._socket.connected)
				return;
	
			this._socket.sendMessageData(msgID,msgData);
		}
		
		public function connectSocket(ip:String,port:int):void
		{
			if(this._socket.connected)
				return;
			this._socket.connect(ip,port);
		}
		
		public function setConnectFun(fun:Function):void
		{
			this._socket.setConnectFun(fun);
		}
		
		public function setDisConnectFun(fun:Function):void
		{
			this._socket.setDisConnectFun(fun);
		}
		
		public function disconnected():void
		{
			this._socket.close();
		}
	}
}